import 'package:flutter/cupertino.dart';
import 'package:hitutor/Util/DateUtil.dart';
import 'package:hitutor/Util/MyColor.dart';

class ItemNotice extends StatelessWidget {
  dynamic data = false;
  Function()? onTap;

  ItemNotice(this.data, {this.onTap});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      behavior: HitTestBehavior.opaque,
      child: Container(
          child: Column(children: [
        Row(children: [
          Container(width: 12, height: 40),
          Text("${getShortDate(data["beginDateTime"])}", style: TextStyle(fontSize: 12, color: MyColor.C99)),
          Container(width: 12),
          data["confirmDateTime"] == null
              ? Text("New!!", style: TextStyle(fontSize: 12, color: MyColor.Red, fontWeight: FontWeight.bold))
              : Container(),
          Container(width: 12),
          Expanded(
              child: Text("${data["title"]}",
                  overflow: TextOverflow.ellipsis, maxLines: 1, style: TextStyle(fontSize: 12, color: MyColor.Black))),
        ]),
        Container(height: 0.5, color: MyColor.DD)
      ])),
    );
  }
}

class ItemMessage extends StatelessWidget {
  dynamic information;
  Function()? onTap;

  ItemMessage(this.information, {this.onTap});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      behavior: HitTestBehavior.opaque,
      child: Container(
          child: Column(children: [
        Row(children: [
          Container(width: 12, height: 40),
          Text("${information["informationDate"]}", style: TextStyle(fontSize: 12, color: MyColor.C99)),
          Container(width: 12),
          Expanded(
              child: Text("${information["title"]}",
                  overflow: TextOverflow.ellipsis, maxLines: 1, style: TextStyle(fontSize: 12, color: MyColor.Black))),
          Container(width: 12),
        ]),
        Container(height: 0.5, color: MyColor.DD)
      ])),
    );
  }
}
